package com.jinhongone.pattern.behavior.observer.JdkExample;

import java.util.Observable;

/**
 * @author jinho
 * @className Thief
 * @description 被观察者（通过jdk提供的接口实现）
 * @date 2025/4/16 16:11
 */
public class Thief extends Observable {

    private String name;

    public Thief(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void steal(){
        System.out.println(name + "开始偷东西...");
        this.setChanged();
        this.notifyObservers();
    }
}
